#ifndef EGG_PIXELBUFFER_H
#define EGG_PIXELBUFFER_H

#include "Texture.h"

namespace egg{

    class PixelBuffer;
    typedef shared_ptr<PixelBuffer> PixelBufferPtr;

    class PixelBuffer{
    public:
        enum Type{
            UNPACK=GL_PIXEL_UNPACK_BUFFER,
            PACK=GL_PIXEL_PACK_BUFFER
        };
    public:
        PixelBuffer(Type type);
        ~PixelBuffer();
        void resize(uint32 size,BufferUsage usage);
        void fromScreen(uint32 w,uint32 h);
        void fromTexture(TexturePtr tex);
        void toTexture(TexturePtr tex);
        void* _lock(BufferAcess acess);
        void _unlock();

        inline uint32 getID(){
            return mID;
        }
    protected:
        Type mType;
        GLuint mID;
        GLuint mSize;
        GLuint mWidth;
        GLuint mHeight;
        BufferUsage mUsage;
        PixelFormat mPixelFormat;
    };

}

#endif